<template>
  <view class="points-detail">
    <!-- <view class="custom-nav-bar"> -->
    <!-- 返回按钮 -->
    <!-- <view class="nav-back" @click="goBack">
        <image src="/static/back.png" mode=""></image>
      </view> -->
    <!-- 页面标题 -->
    <!-- <view class="nav-title">积分明细</view>
    </view> -->
    <z-paging ref="paging" v-model="scoreList" @query="queryList">
      <template #empty>暂无数据</template>
      <div class="detail-list">
        <div
          class="detail-item"
          v-for="(item, index) in scoreList"
          :key="index">
          <div class="item-left">
            <image :src="img1" mode=""></image>
            <div class="lefttxt">
              <p>{{ item.memo }}</p>
              <span>{{ item.createtime_text }}</span>
            </div>
          </div>
          <div class="jfnum">
            {{ item.score > 0 ? "+" : "" }}{{ item.score }}
          </div>
        </div>
        <!-- <u-loadmore :status="status" /> -->
      </div>
    </z-paging>
  </view>
</template>

<script>
import { getSignList } from "@/api/mine.js";
export default {
  data() {
    return {
      scoreList: [],
      status: "nomore",
      formData: {
        page: 1,
        page_size: 10,
        // month: ''
      },
      img1: this.$Config.HTTP_REQUEST_URL + "/zufang/jifenmingxi.png",
    };
  },
  onLoad(option) {
    console.log(option, "ddddddd");
    // this.formData.month = option.signDate;
    // this.getSignList();
  },
  methods: {
    async queryList(pageNo, pageSize) {
      const res = await getSignList({
        page: pageNo,
        page_size: pageSize,
      });
      if (res.response.statusCode === 200) {
        if (res.data.data.data.length != 0) {
          this.$refs.paging.complete(res.data.data.data);
        } else {
          this.$refs.paging.complete(false);
        }
      }
    },
    async getSignList() {
      const res = await getSignList(this.formData);
      if (res.response.statusCode === 200) {
        this.scoreList = res.data.data.data;
        // console.log(res.data.data, 'this.contentObj');
      } else {
        this.scoreList = [];
      }
    },
    // // 下拉刷新
    // onPullDownRefresh() {
    //   this.formData.page = 1; // 重置为第一页
    //   this.scoreList = []; // 清空当前列表数据
    //   this.getSignList(); // 请求第一页数据
    //   uni.stopPullDownRefresh(); // 停止下拉刷新
    // },
    // //上拉加载
    // onReachBottom() {
    //   console.log("Reached bottom. Status:", this.status);
    //   if (this.status === "loading" || this.status === "nomore") return;
    //   this.status = "loading";
    //   this.formData.page++; // 增加当前页码
    //   this.getSignList();
    // },
  },
};
</script>

<style lang="scss" scoped>
.custom-nav-bar {
  height: 50px; /* 导航栏高度 */
  display: flex;
  align-items: center;
  color: #000;
  padding: 30px 16px 16px 16px;
}
.nav-back {
  flex: 0 0 auto;
  cursor: pointer;
  image {
    width: 12px;
    height: 24px;
    // padding-left: 16px;
  }
}
.nav-title {
  flex: 1 1 auto;
  text-align: center;
  font-family: PingFangSC, PingFang SC;
  font-weight: 500;
  font-size: 17px;
  color: #000000;
}
.detail-item {
  width: 84%;
  padding: 16px;
  margin: 20px auto;
  background: #ffffff;
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  .item-left {
    display: flex;
    image {
      width: 25px;
      height: 26px;
    }
    .lefttxt {
      margin-left: 10px;
      p {
        font-weight: 500;
        font-size: 15px;
        color: #222222;
        line-height: 30px;
      }
      span {
        font-weight: 400;
        font-size: 12px;
        color: #999999;
      }
    }
  }
  .jfnum {
    font-weight: 600;
    font-size: 16px;
    color: #0095f8;
  }
}
</style>
